package com.work.demo.enumdemo;

import lombok.Getter;

import java.util.Arrays;

/**
 * 临时目录组件枚举类
 *
 * @author LinYa
 * @Date: 2022年10月19日16:22:23
 */
public enum DataTypeEnum {

    /**
     * 普通样本集加载器
     */
    FL_DATA_ALIGN_V1("cn.fudata.FL_DATA_ALIGN","v1.0.0", "样本集加载器v1.0.0"),
    FL_DATA_ALIGN_V2("cn.fudata.FL_DATA_ALIGN","v2.0.0", "样本集加载器v2.0.0"),

    /**
     * BIG样本集加载器
     */
    FL_DATA_ALIGN_BIG_V1("cn.fudata.FL_DATA_ALIGN_BIG","v1.0.0", "样本集加载器_BIGv1.0.0"),
    FL_DATA_ALIGN_BIG_V2("cn.fudata.FL_DATA_ALIGN_BIG","v2.0.0", "样本集加载器_BIGv2.0.0"),
    DATASET_LOADER_MPC_V1_0_0("cn.fudata.FL_DATA_ALIGN_MPC", "v1.0.0", "样本集加载器_MPC"),
    FL_HORIZONTAL_DATA_ALIGN_BETA("cn.fudata.FL_HORIZONTAL_DATA_ALIGN", "beta", "横向样本集加载器")
    ;

    @Getter
    private String wareId;

    @Getter
    private String version;

    private String name;

    DataTypeEnum(String wareId, String version, String name) {
        this.wareId = wareId;
        this.version = version;
        this.name = name;
    }

    public static DataTypeEnum parse(String wareId, String version) {
        return Arrays.stream(DataTypeEnum.values())
                .filter(entry -> entry.getWareId().equals(wareId) && entry.getVersion().equals(version))
                .findFirst().orElse(null);
    }
}
